/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.esisar.picaso.ihm;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;

/**
 *
 * @author THOMAS
 */
public class CustomizedJDesktopPane extends JDesktopPane{
    private Image backImage = new ImageIcon("image/picaso.jpg").getImage();
    
    public void paintComponent( Graphics g )
    {
       if(backImage == null)
          super.paintComponent(g);
       else
       {
          Graphics2D g2d = (Graphics2D)g;

          //scale the image to fit the size of the Panel
          double mw = backImage.getWidth(null);
          double mh = backImage.getHeight(null);

          double sw = getWidth() / mw;
          double sh = getHeight() / mh;

          g2d.scale(sw, sh);
          g2d.drawImage(backImage, 0, 0, this);
       }
    }
}
